Skip to content

C++: Fix false-positive in 'cpp/incorrect-allocation-error-handling'#6471

Merged
geoffw0 merged 3 commits intogithub:mainfrom
MathiasVP:fix-fp-in-incorrect-allocation-error-handling
Aug 11, 2021
Merged

C++: Fix false-positive in 'cpp/incorrect-allocation-error-handling'#6471
geoffw0 merged 3 commits intogithub:mainfrom
MathiasVP:fix-fp-in-incorrect-allocation-error-handling

Conversation

@MathiasVP
Copy link
Copy Markdown
Contributor

Fixes #6435.

Turns out we didn't recognize the std::nothrow parameter in void *operator new(std::size_t, const std::nothrow_t &); because it was hidden behind a reference type.

We didn't catch this in the original PR because I included a noexcept specifier in all of the overloads where we had a std::nothrow_t & parameter 🤦 .

…er, but not a 'noexcept' specifier. This case was previously not reported because of the 'noexcept' specifier, and apparently the 'std::nothrow' case was broken all along.
Copy link
Copy Markdown
Contributor

@geoffw0 geoffw0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Otherwise LGTM.

Comment thread cpp/ql/test/query-tests/Security/CWE/CWE-570/test.cpp Outdated
Co-authored-by: Geoffrey White <40627776+geoffw0@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

@geoffw0 geoffw0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@geoffw0 geoffw0 merged commit 3f72a1a into github:main Aug 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C++ no-change-note-required This PR does not need a change note

Projects

None yet

Development

Successfully merging this pull request may close these issues.

LGTM.com - cpp/incorrect-allocation-error-handling false positive with std::nothrow

2 participants